package com.baosan.school.controller;

import com.baosan.school.mapper.ReportMapper;
import com.baosan.school.po.Report;
import com.baosan.school.po.Result;
import com.baosan.school.po.ResultEnum;
import com.baosan.school.service.ReportService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * @program: school
 * @description:
 * @author: heping
 * @create: 2022-01-14 10:11
 */
@RestController
@RequestMapping("/report")
@CrossOrigin
public class ReportController {
    @Autowired
    private ReportService reportService;

    @RequestMapping("/getPage")
    public Result<PageInfo<Report>> getPage(Report report){
        Result<PageInfo<Report>> result = new Result<>();
        result.setCode(ResultEnum.SUCCESS.getKey());
        result.setData(reportService.getReport(report));
        return result;
    }

    @RequestMapping("/getReport")
    public Result<Report> getReport(Report report){
        return reportService.getOne(report);
    }
    //获取班级列表
    @RequestMapping("/getClassList")
    public Result<List<Report>> getClassList(Report report){
        return reportService.getClassList(report);
    }
}

